home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
crwtim
/
time_1.txt
< prev
next >
Wrap
Text File
|
1994-04-22
|
821b
|
38 lines
// Time Format for CRYSTAL Reports (12:00 AM/PM format)
//
// Convert MS ACCESS Time to Whole Number
NumberVar TotWholeNbr:={Time.Time}*100000000;
// Calculate Hours
NumberVar Hours:=Truncate(TotWholeNbr/4166666.64);
// Calculate Minutes
NumberVar Mins:=Truncate((TotWholeNbr-(Hours*4166666.64))/69444.444);
// Set AM/PM String
If Hours>=12 Then
StringVar AMPM:="PM";
If Hours<12 Then
StringVar AMPM:="AM";
If Hours=0 then
Hours:=12;
// If past 13:00, adjust hours
If Hours>12 Then
Hours:=Hours-12;
// Set Hour String
If Hours<10 Then
StringVar HH:="0"+ToText(Hours)
Else
StringVar HH:=ToText(Hours);
// Set Minute String
If Mins<10 Then
StringVar MM:="0"+ToText(Mins)
Else
StringVar MM:=ToText(Mins);
// Output Time
HH[1 to 2]+":"+MM[1 to 2]+" "+AMPM[1 to 2];